import * as store from '@/api/store';
import { toTranslateLang, deepClone } from '@/utils/index.js';
const getters = {
  sidebar: (state) => state.app.sidebar,
  size: (state) => state.app.size,
  device: (state) => state.app.device,
  visitedViews: (state) => state.tagsView.visitedViews,
  cachedViews: (state) => state.tagsView.cachedViews,
  token: (state) => state.user.token,
  avatar: (state) => state.user.avatar,
  name: (state) => state.user.name,
  introduction: (state) => state.user.introduction,
  roles: (state) => state.user.roles,
  permission_routes: (state) => state.permission.routes,
  permissions: (state) => state.user.permissions,
  sidebarRouters: (state) => state.permission.sidebarRouters,
  errorLogs: (state) => state.errorLog.logs,
  isLogin: (state) => state.user.isLogin,
  adminProductClassify: (state, getters) => {
    let arr = deepClone(state.product.adminProductClassify);
    arr = toTranslateLang(arr, localStorage.getItem('LANG'));
    return arr;
  },
  productBrand: (state) => state.product.productBrand,
  merchantClassify: (state) => state.merchant.merchantClassify,
  merchantType: (state) => state.merchant.merchantType,
  locale: (state) => state.user.locale,
  adminProductClassifyArr: (state) => state.product.adminProductClassifyArr,
  translateAdminProductClassifyArr: (state, getters) => {
    let arr = deepClone(state.product.adminProductClassifyArr);
    arr = toTranslateLang(arr, localStorage.getItem('LANG'));
    return arr;
  },
};

export default getters;
